@extends('admin.layouts.index')
@section('content')
	    <!--面包屑导航 开始-->

    <!--面包屑导航 结束-->

	<!--结果页快捷搜索框 开始-->
	<div class="search_wrap">
        <form action="" method="get">
            <table class="search_tab">
                <tr>
                    <th width="70">关键字:</th>
                    <td><input type="text" name="keywords" placeholder="关键字" ></td>
                    <td><input type="submit"  value="查询"></td>
                </tr>
            </table>
        </form>
    </div>
    <!--结果页快捷搜索框 结束-->

    <!--搜索结果页面 列表 开始-->
    <form action="#" method="post" >
        <div class="result_wrap">
            <!--快捷导航 开始-->
            <div class="result_content">
                <div class="short_wrap">
                    <a href="#"><i class="fa fa-plus"></i>新增文章</a>
                    <a href="#"><i class="fa fa-recycle"></i>批量删除</a>
                    <a href="#"><i class="fa fa-refresh"></i>更新排序</a>
                </div>
            </div>
            <!--快捷导航 结束-->
        </div>

        <div class="result_wrap">
            <div class="result_content">
                <table class="list_tab">
                    <tr>
                        <th class="tc" width="5%">选择</th>
                        <th class="tc">ID</th>
                        <th>标题</th>
                        <th>内容</th>
                        <th>分类</th>
                        <th>状态</th>
                        <th>发布时间</th>
                        <th>发帖人</th>
                        <th>操作</th>
                    </tr>
                    @foreach ($data as $da)
                    <tr>
                        <td class="tc"><input type="checkbox" name="id[]" value="59"></td>
                        <td class="tc">{{$da->id}}</td>
                        <td>
                            <a href="#">{{$da->title}}</a>
                        </td>
                        <td>{{$da->content}}</td>
                        <td>{{$da->amodule->mname}}</td>
                        <td>{{$da->state}}</td>
                        <td>{{$da->ntime}}</td>
                        <td>{{$da->huser->nickname }}</td>
                        <td>
                            <a href="{{url('/admin/anote/'.$da->id.'/edit')}}">禁言</a>
                            <a href="javascript:" onclick="delUser({{$da->id}})">删除</a>
                        </td>
                    </tr>
                    @endforeach
                </table>





                <div class="page_list">
               {!! $data->appends(['keywords'=>$input])->render() !!}
               </div>
                <style>
                    .pagination li span{
                        padding: 6px 12px;
                    }
                </style>
            </div>
        </div>
    </form>
    <!--搜索结果页面 列表 结束-->
<script type="text/javascript">
        function delUser(userid){

            layer.confirm('确认删除吗？', {
                btn: ['确定','取消'] //按钮
            }, function(){
                //向服务器发送删除请求
//                $.ajax(请求的路径，携带的参数，返回的结果)
//                url===>admin/user/21
                $.post("{{url('admin/anote/')}}/ "+userid,{'_token':'{{csrf_token()}}','_method':'delete'},function(data){
                       if( data.status == 0){
//                            将json格式的字符串变成json对象
//                           var data = JSON.parse(data);
                           layer.msg(data.msg, {icon: 6});
                           location.href = location.href;
                       }else{
                           layer.msg(data.msg, {icon: 5});
                           location.href = location.href;
                       }
                });
                //
            }, function(){

            });
        }
</script>
            @if(session('msg'))
               <h3 style="color:red">{{ session('msg') }}</h3>
            @endif

@endsection